package com.tm.utils;

import java.util.Random;

/**
 * @author huangp
 * @create 2023-04-18 15:16
 */
//随机生成验证码工具类
public class CodeUtils {

    public static String genarterCode(){
        //字符串拼接
        StringBuilder str = new StringBuilder();
        //生成随机数
        Random random = new Random();
        //生成六位数
        for (int i = 0; i < 6; i++) {
            //0-9
            int num = random.nextInt(9);
            str.append(num);
        }
        return str.toString();
    }

    public static void main(String[] args) {
        System.out.println(genarterCode());
    }

}
